<template>
  <view class="container">
    <view class="content">
      <view class="top_kong"></view>
      <view class="top_box">
        <image src="../../static/image/ico_dh_bk@2x.png"
               @click="goBack"></image>
        <!-- <view class="top_box_right">注册</view> -->
      </view>
      <view class="login_box">
        <view class="login_title">修改邮箱</view>
        <view class="login_input_box">
          <view class="login_input_item">
            <input type="text"
                   value=""
                   placeholder="请输入邮箱"
                   placeholder-class="input_class"
                   v-model="mail"
                   @input="MinputEvent" />
            <image class="clear_btn"
                   src="../../static/image/ico_gb@2x.png"
                   mode=""
                   v-show="showclear"
                   @click="clearMobile"></image>
          </view>
        </view>
        <view class="login_btn1"
              v-if="showclear==true"
              @click="goEdit">确认</view>
        <view class="login_btn"
              v-else>确认</view>
      </view>
    </view>
  </view>

</template>

<script>
export default {
  data() {
    return {
      mail: '',
      showclear: false,
      showclear1: false,
      seeStatus: false,
      remember: false,
      showyanz: true,
      time: 60
    }
  },
  methods: {
    MinputEvent() {
      if (this.mail != '') {
        this.showclear = true
      } else {
        this.showclear = false
      }
    },
    showSee() {
      this.seeStatus = !this.seeStatus
    },
    chooseJz() {
      this.remember = !this.remember
    },
    clearMobile() {
      this.mail = ''
      this.showclear = false
    },
    clearPsd() {
      this.password = ''
    },
    goBack() {
      uni.navigateBack({
        delta: 1
      })
    },
    goNext() {
      uni.navigateTo({
        url: 'editPhoneNew'
      })
    },
    async goEdit() {
      const { data } = await this.$http.post('/user/changeemail', { email: this.mail })
      if (data.code == 1) {
        uni.showToast({
          title: data.msg,
          icon: 'none',
          duration: 2000
        })
        setTimeout(() => {
          uni.navigateBack({
            delta: 1
          })
        }, 1000)
      } else {
        uni.showToast({
          title: data.msg,
          icon: 'none',
          duration: 2000
        })
      }
    }
  }
}
</script>

<style>
.content {
  width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  overflow: hidden;
}
.top_kong {
  width: 100%;
  height: var(--status-bar-height);
}
.top_box {
  width: 100%;
  height: 100rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30rpx;
}
.top_box image {
  width: 20rpx;
  height: 36rpx;
}
.top_box_right {
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
}
.login_box {
  width: 100%;
  margin-top: 10%;
  height: 650rpx;
}
.login_title {
  width: 80%;
  margin: auto;
  font-size: 44rpx;
  font-family: PingFang SC;
  font-weight: bold;
  color: #333333;
}
.login_input_box {
  width: 80%;
  height: 100rpx;
  margin: 0 auto;
  margin-top: 40rpx;
}
.login_input_item {
  width: 100%;
  height: 100rpx;
  display: flex;
  align-items: center;
  border-bottom: 1rpx solid #e5e5e5;
  justify-content: space-between;
}
.input_class {
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
}
input {
  width: 80%;
}
.login_btn {
  width: 80%;
  height: 88rpx;
  margin: auto;
  background: #dddddd;
  border-radius: 10rpx;
  font-size: 30rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 60rpx;
}
.login_btn1 {
  width: 80%;
  height: 88rpx;
  margin: auto;
  background: linear-gradient(90deg, #ffdd47, #fcb630);
  border-radius: 10rpx;
  font-size: 30rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 60rpx;
}
.login_other_box {
  width: 80%;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40rpx;
}
.login_other_l image {
  width: 26rpx;
  height: 26rpx;
}
.login_other_r {
  font-size: 24rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #666666;
}
.btm_box {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 22rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
  position: absolute;
  bottom: 40rpx;
}
.xy_color {
  font-size: 22rpx;
  color: #333333;
}
.clear_btn {
  width: 26rpx;
  height: 26rpx;
}
.see_btn {
  width: 26rpx;
  height: 18rpx;
  margin-left: 20rpx;
}
.see_btn1 {
  width: 26rpx;
  height: 16rpx;
  margin-left: 20rpx;
}
.code_btn {
  width: 130rpx;
  height: 50rpx;
  border: 1rpx solid #dddddd;
  border-radius: 6rpx;
  font-size: 22rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
